package com.javaweb.httpservlet3;

import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;

public class BServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        //获取系统当前时间
        //Date nowTime = new Date();

        // 从request域当中取出绑定的数据
        Object obj = request.getAttribute("sysTime");

        //输出到浏览器
        out.print("request域当中获取的系统当前时间 = " + obj + "<br>");

        //ServletContext context = this.getServletContext();
        //out.print(context.getAttribute("s"));



    }
}
